Reflection Support: Java Reflection Made Easy

نویسندگان

  • Zalia Shams
  • Stephen H. Edwards
چکیده

Large software projects often require the ability to load and manage new code assets that were not originally available during system compilation. Moreover, testing tools need to inspect and run code components regardless of their structures. Reflection in Java supports these tasks by providing programmers with facilities to dynamically create objects, invoke methods, access fields, and perform code introspection at runtime. These capabilities come at the cost of reduced readability and writeability, since code written using Java’s reflection classes is clunky, bulky and unintuitive. Common tasks such as object creation, method invocation, and field manipulation need to be decomposed into multiple steps that require try-catch blocks to guard against checked exceptions. Type casts and explicit use of class types as parameters make development and maintenance of code difficult, time consuming and error prone. In this paper, we discuss the difficulties of using reflection in Java. We also present an open-source library called ReflectionSupport that addresses these problems and makes reflection in Java easier to use. ReflectionSupport provides static helper methods that offer the same reflective capabilities but that encapsulate the overhead of coding with reflection. This paper focuses on improving the usability of Java reflection by presenting an API that allows programmers to obtain the benefits of reflection without the

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Reflections on Remote Reflection

The Java programming language provides both reflection and remote method invocation: reflection allows a program to inspect itself and its runtime environment, remote method invocation allows methods to be invoked transparently across a network. Unfortunately, the standard Java implementations of reflection and remote method invoca-tion are incompatible: programmers cannot reflect on a remote a...

متن کامل

Flexible metaprogramming and AOP in Java

Advanced programming techniques such as metaprogramming and computational reflection, as well as the more recent paradigm of aspect-oriented programming (AOP), serve important objectives of software engineering such as modularization and adaptability. In this tool presentation paper, we briefly overview this area and present Reflex, a tool for flexible metaprogramming and AOP in Java. Based on ...

متن کامل

1 Java ’ s Reflection Model and Design Patterns

Dynamic proxies support meta-programming and extend the reflective abilities of Java beyond pure introspection. Proxy objects are interpreted as meta-objects that control the behaviour of application objects at the base level. In this paper, we investigate the implications of applying reflective programming techniques provided by proxies. We address the problem of how such proxies can support o...

متن کامل

metaXa and the Future of Reflection

Reflection has attracted considerable attention in recent years. However there are very little systems that fully support reflective programming and are in real use. In this paper we try to understand the reasons for this lacking acceptance of fully reflective systems and explain how our own reflective Java system, metaXa, tries to tackle some of these problems.

متن کامل

Exploiting Reflection to Add Persistence and Query Optimization to a Statically Typed Object-Oriented Language

It is popular and appealing to design and construct a persistent programming language by extending the semantics of a non-persistent language appropriately and then modifying its compiler and run-time system to implement the extended semantics. We describe here how to achieve this, and furthermore, how to support query optimization, which is typically neglected in persistent programming languag...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2013